<?php

namespace App\Validate;

use App\Validate\BaseValidate;

/**
 * 验证器
 */
class ResourceSystemTypeValidate extends BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'bail|required|integer',
        'ids' => 'bail|required',
        'resource_system_type_id' => 'bail|required|integer',
        'type_name' => 'bail|required',
        'content' => 'bail|required',
        'way' => 'bail|required|in:1,2,3,4,5',
        'location' => 'bail|required|in:0,1,2,3,4,5,99',
        'is_play' => 'bail|required|in:1,2',
    ];
    //自定义验证信息
    protected $message = [
        'id.required' => 'ID不能为空',
        'id.integer' => 'ID格式不正确',
        'ids.required' => 'ID不能为空',
        'resource_system_type_id.required' => 'ID不能为空',
        'resource_system_type_id.integer' => 'ID格式不正确',
        'type_name.required' => '名称不能为空',
        'way.required' => '书籍获取方式不能为空',
        'way.integer' => '书籍获取方式格式不正确',
        'way.in' => '书籍获取方式格式不正确',
        'location.required' => '显示位置不能为空',
        'location.integer' => '显示位置格式不正确',
        'location.in' => '显示位置格式不正确',

        'is_play.required' => '是否显示不能为空',
        'is_play.in' => '是否显示规则不正确',
        'content.required' => '内容不能为空',
    ];

    //自定义场景
    protected $scene = [
        'add' => ['type_name', 'way', 'location'], //添加
        'detail' => ['id'], //详情
        'change' => ['id', 'type_name', 'location'], //修改
        'del' => ['id'], //删除
        'info' => ['id'], //详情

        'cancel_and_release' => ['ids', 'is_play'], //切换显示方式

        'sort_change' => ['content'], //排序


        'wx_get_system_type_book_list' => ['resource_system_type_id'], //根据系统栏目id获取书籍列表
    ];
}
